package com.cnswhy.cloud.server.merchant.controller.customer;

import com.cnswhy.cloud.common.core.base.R;
import com.cnswhy.cloud.common.core.base.controller.SuperController;
import com.cnswhy.cloud.server.core.dto.CustomerAlipayPageDTO;
import com.cnswhy.cloud.server.core.dto.CustomerAlipaySaveDTO;
import com.cnswhy.cloud.server.core.dto.CustomerAlipayUpdateDTO;
import com.cnswhy.cloud.server.core.entity.CustomerAlipay;
import com.cnswhy.cloud.server.core.service.customer.CustomerAlipayService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

//import com.github.zuihou.security.annotation.PreAuth;


/**
 * <p>
 * 前端控制器
 * 
 * </p>
 *
 * @author cnswhy
 * @date 2020-10-19
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/customerAlipay")
@Api(value = "CustomerAlipay", tags = "")
//@PreAuth(replace = "customerAlipay:")
public class CustomerAlipayController extends SuperController<CustomerAlipayService, Long, CustomerAlipay, CustomerAlipayPageDTO, CustomerAlipaySaveDTO, CustomerAlipayUpdateDTO> {

    /**
     * Excel导入后的操作
     *
     * @param list
     */
    @Override
    public R<Boolean> handlerImport(List<Map<String, String>> list){
        List<CustomerAlipay> customerAlipayList = list.stream().map((map) -> {
            CustomerAlipay customerAlipay = CustomerAlipay.builder().build();
            return customerAlipay;
        }).collect(Collectors.toList());

        return R.success(baseService.saveBatch(customerAlipayList));
    }
}
